package com.leonzhangxf.spel.beandefinition.annotation;

import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * A demo use for expression analysis in constructor injection.
 *
 * @author leonzhangxf
 * @date 20190427
 */
@Component
@Data
public class MovieRecommender {

    private String defaultLocale;

    private CustomerPreferenceDao customerPreferenceDao;

    @Autowired
    public MovieRecommender(CustomerPreferenceDao customerPreferenceDao,
                            @Value("#{systemProperties['user.country']}") String defaultLocale) {
        this.customerPreferenceDao = customerPreferenceDao;
        this.defaultLocale = defaultLocale;
    }

    @Component
    @Data
    public static class CustomerPreferenceDao {
        private String dao;
    }
}
